<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@page import="sohsite.fachada.SistemaSohSite"%>
<%@page import="java.util.Collection"%>
<%@page import="sohsite.usuario.Usuario;"%>
<html>

	<head>
		<meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
		<title>SohSite</title>
		<link rel="stylesheet" type="text/css" href="../sohsite.css"/>
	</head>
	<script language="javascript">
		function escolherModerador(mod){
			var idModerador;
			if(mod == "mod1")
				idModerador = document.form.mod1.value;
			if(mod == "mod2")
				idModerador = document.form.mod2.value;
			if(mod == "mod3")
				idModerador = document.form.mod3.value;
				
			window.open('comboModerador.jsp?&mod=' +mod +'&idModerador=' +idModerador,'name','height=100,width=500');
		}
	</script>
		
	<%
	SistemaSohSite sistema = SistemaSohSite.getInstancia();
	Collection<Usuario> usuarios = sistema.getControladorUsuario().consultarTodosUsuarios();
	
	String login = (String)session.getValue("loginUsuario");	
	Usuario userLogin = sistema.getControladorUsuario().consultarUsuarioPorLogin(login);
	if (userLogin == null){
		response.sendRedirect("../login.jsp");
		return;
	}
	
	boolean isAdmin = false;
	if (login.equals("admin")){
		isAdmin = true;
	}
		
	%>

	<body>
<%	if (isAdmin){
%>		<%@ include file="cabecalhoAdmin.inc" %>
<%	}else{
%>		<%@ include file="cabecalhoUser.inc" %>
<%	}
%>	
		<div id="leftSection">&nbsp;</div>
		<div id="midsection">
			<form name="form" action="../../ServletInserirPelada" method="POST" id="formInserirPelada">
			<input type="hidden" name="url" value="./jsp/pelada/inserirPelada.jsp">
			<input type="hidden" name="mod1" value="" >
			<input type="hidden" name="mod2" value="" >
			<input type="hidden" name="mod3" value="" >
  				<fieldset>
   					<h2 align=center>Inserir Pelada</h2>
 					<br>
					<label>Nome:</label>
        			<input name="nome" type="text" size=65 maxlength="200" value=""/>
					<br>
                    <label>Moderadores:</label>
                    <br>
                    <label >Moderador 1:</label>
					 <input type="text" name="mod1nome" size=55 readonly /><input type="button" onclick="escolherModerador('mod1');" value="buscar"/>
               		<br>
                    <label >Moderador 2:</label>
                    <input type="text" name="mod2nome" size=55 readonly /><input type="button" onclick="escolherModerador('mod2');" value="buscar"/>
                    <br>					
                    <label >Moderador 3:</label>
                    <input type="text" name="mod3nome" size=55 readonly /><input type="button" onclick="escolherModerador('mod3');" value="buscar"/>				
                	<br>
				    <input  alt="" type="submit" value="Salvar" class="botao"/>
  				</fieldset>      
			</form>
		</div>
		<div id="rightSection">&nbsp;</div>
		<div id="footer">
		</div>

	</body>

</html>